<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<%@ page isELIgnored="false"%>
<html>
	<head>
		<title>员工任务MAIN-SJH</title>
	</head>
<e:View id="eView" designProperty="width: 1024; height: 768">
	<script type="text/javascript" src="<c:url value='/scripts/global.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/scripts/skin.js'/>"></script>
	<script type="text/javascript">SkinUtil.getSkin();</script>
	<script type="text/javascript">SkinUtil.getModuleSkin();</script>	
	<script type="text/javascript" src="<c:url value='/js/perform/perform.js'/>"></script>
	
	<div id="Invisual Controls" style="min-height: 40px;">
	<!-- 考核方案  -->
		<e:Dataset id="Dataset_project" pageSize="-1">
			<e:Field name="projectId" dataType="string" label="考核方案ID" maxLength="32" visible="false"/>
			<e:Field name="projectName" dataType="string" label="考核方案名称" maxLength="100" />		
		</e:Dataset> 
	<!--考核阶段 -->
		<e:Dataset id="Dataset_project_segment" pageSize="-1">
			<e:Field name="segmentId" label="分段ID" dataType="string"/>
			<e:Field name="projectId" label="考核方案ID" dataType="string"/>
			<e:Field name="cycleId" label="阶段周期ID" dataType="string"/>
			<e:Field name="segmentName" label="考核阶段名称" dataType="string"/>
			<e:Field name="status" label="状态" dataType="string"/>
			<e:Field name="startDate" label="开始日期" dataType="date"/>
			<e:Field name="endDate" label="结束日期" dataType="date"/>
			<e:Field name="scoreTime" label="计算时间"  dataType="date"/>
			<e:Field name="cycleName" label="阶段周期名称"  dataType="string"/>
		</e:Dataset>

	<!-- 考核方案ID对应名称 -->
		<e:DataDropDown id="DataDropDown_projectIdToName" dataset="Dataset_project"
		      visibleFields="projectName" codeField="projectId" textField="projectName" showColumnHeader="false" fixed="true"
		      onAfterSelect="DataDropDown_projectIdToName_onAfterSelect()">
		</e:DataDropDown>
	<!-- 考核分段ID对应名称 -->
		<e:DataDropDown id="DataDropDown_segmentIdToName" dataset="Dataset_project_segment"
		      visibleFields="cycleName" codeField="segmentId" textField="cycleName" showColumnHeader="false" fixed="true"
		      onAfterSelect="DataDropDown_segmentIdToName_onAfterSelect()">
		</e:DataDropDown>		
		
	<!-- 获取考核方案ID对应名称 -->
		<e:Command id="Command_queryProjectIdToName" action="com.longtop.perform.khyg.web.TaskAction" method="queryProjectIdToName" showHintInfoOnSuccess="false">
			<e:DatasetInfo name="info1" dataset="Dataset_project" submitType="none" alwayRefreshClient="true"/>
		</e:Command>	
	<!-- 获取考核方案对应分段 -->
		<e:Command id="Command_queryProjectSegment" action="com.longtop.perform.khyg.web.TaskAction" method="queryProjectSegment" showHintInfoOnSuccess="false">
			<e:DatasetInfo name="info1" dataset="Dataset_project_segment" submitType="none" alwayRefreshClient="true"/>
			<e:Parameter name="projectId" dataType="string"/>
		</e:Command>

<body style="overflow: auto">
<e:Page id="ePage" action="" style="min-height: 80px; width: 100%; height: 100%;"  onAfterLoadPage="ePage_onAfterLoadPage()" onBeforeLoadPage="ePage_onBeforeLoadPage()">
 <table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0" align="center">
		 <tr>
			<td align="left" valign="top">
					<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" >
						<tr>
							<td valign="top" align="left">	
								<e:GroupBox id="GroupBox_project" style="width: 100%; " caption="考核方案">
									<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3">
										<tr>
											<td align="right" nowrap="nowrap">&nbsp;&nbsp;</td>
											<td align="right" nowrap="nowrap"><e:Label id="Label_projectName" caption="考核方案"/></td>
											<td align="left"> 
												<e:Text id="Text_projectName" dropDown="DataDropDown_projectIdToName" style="width:250px"/>
	                						</td>									
											<td align="right" nowrap="nowrap"><e:Label id="Label_segmentName" caption="选择阶段"/></td>
											<td align="left" width="99%">
												<e:Text id="Text_segmentName" dropDown="DataDropDown_segmentIdToName" style="width:250px"/>
											</td>
										</tr>
									</table>
								</e:GroupBox>
							</td>
						</tr>
						<tr>
							<td>
								<!-- 员工任务明细页面： -->
								<iframe style="width: 100%; height: 350px" id="IframePage" src="" frameborder="0"></iframe>								
							</td>
						</tr>	
					<table>
			</td>
		</tr>
	</table>
</e:Page>
</body>
<script language="Javascript">
	var task = "${param.task}";
	//init:
	function ePage_onBeforeLoadPage(){

	}
	function ePage_onAfterLoadPage(){
		Command_queryProjectIdToName.execute();
	}
	//获取考核任务对应的员工明细
	function DataDropDown_segmentIdToName_onAfterSelect(){
	    var projectId = Dataset_project.getValue("projectId");
	 	var segmentId = Dataset_project_segment.getValue("segmentId");
	 	var path;
	 	if(task == "view"){//员工任务查看
	 		path= "jsp/perform/khyg/project/task/taskView.jsp?task=view";
	 	}else if (task == "track"){//员工任务跟踪
	 		path= "jsp/perform/khyg/project/task/taskTrack.jsp?task=track";
	 	}
		IframePage.navigate(__CONTEXT_PATH +path+"&projectId="+projectId+"&segmentId="+segmentId);	
	}
	//选择考核方案-关联考核阶段
	function DataDropDown_projectIdToName_onAfterSelect(){
		IframePage.navigate(__CONTEXT_PATH +"jsp/perform/kh/score/failure.jsp");
		$J("Text_segmentName").setReadOnly(false);
		var projectId = Dataset_project.getValue("projectId");
		Command_queryProjectSegment.parameters.setValue("projectId",projectId);
		Command_queryProjectSegment.execute();

		//考核无分段设置：
		if(isEmpty(Dataset_project_segment.getValue("cycleName"))){
			$J("Text_segmentName").setValue("");
			$J("Text_segmentName").setReadOnly(true);
			DataDropDown_segmentIdToName.onAfterSelect();
		}
	}
</script>
</e:View>
</html>